// 创建数据
function madeData(num) {
  var Mock = require("mockjs");
  var list = [];
  for (var i = 0; i < num; i++) {
    var obj = {
      userId: Mock.mock(/[a-z]{5}\d{5}/),
      username: Mock.Random.last(),
      age: Mock.mock(/(1[89])|2[1-5]/),
      nickname: Mock.Random.cname(),
      work: Mock.mock(/前端工程师|java工程师|UI妹子|测试妹子/),
      email: Mock.Random.email(),
      address: Mock.Random.county(true),
      desc: Mock.Random.cword(50, 100),
      sex: Mock.mock(/[男女]/),
      hobby: Mock.mock(/(羽毛球,)?(蓝球,)?(足球,)?(乒乓球,)?(棒球)?/),
    }; 
    list.push(obj);
  }
  console.log(list); 
  var fs = require("fs");
  fs.writeFileSync("./users.json", JSON.stringify(list));
}

madeData(5);
